package cn.laixueit.exception;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;

@ControllerAdvice
public class MyException {

    @ExceptionHandler(RuntimeException.class)
    public ModelAndView myex1(RuntimeException ex){
        ModelAndView view = new ModelAndView("error");
        view.addObject("msg","您的操作出现了问题，请联系管理员！"+ex.getMessage());
        return view;
    }
}
